# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: net_ssl_client.py 
@time: 2019/7/12 下午3:32
"""
'''
客户端请求认证服务器
'''
from socket import socket, AF_INET, SOCK_STREAM
import ssl

s = socket(AF_INET, SOCK_STREAM)
s_ssl = ssl.wrap_socket(s,
                        cert_reqs=ssl.CERT_REQUIRED,
                        ca_certs='server_cert.pem'
                        )
s_ssl.connect(('localhost', 20000))
s_ssl.send(b'Hello SSL!')
print(s_ssl.recv(8192))